package com.traveldream.entities;

import java.io.Serializable;
import javax.persistence.*;


/**
 * The persistent class for the custom_packet database table.
 * 
 */
@Entity
@Table(name="custom_packet")
@NamedQueries({
	@NamedQuery(name="CustomPacket.findAll", query="SELECT c FROM CustomPacket c"),
	@NamedQuery(name="CustomPacket.findByCustomer",query="SELECT c FROM CustomPacket c WHERE c.user.email LIKE :customerEmail")
})
public class CustomPacket implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="packet_id",insertable=false,updatable=false)
	private int packetId;

	//bi-directional one-to-one association to Packet
	@OneToOne
	private Packet packet;

	//bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name="customer_email")
	private User user;

	public CustomPacket() {
	}

	public int getPacketId() {
		return this.packetId;
	}

	public void setPacketId(int packetId) {
		this.packetId = packetId;
	}

	public Packet getPacket() {
		return this.packet;
	}

	public void setPacket(Packet packet) {
		this.packet = packet;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	

	public float getPrice()
	{
		return this.getPacket().getPrice();
	}

}